<?php
namespace Home\Controller;
class PageController extends CommonController{
	public $channel_list = array(
		'help' => array(
			array('title' => '新手指南', 'module' => 'tutorial'),
			array('title' => '常见问题', 'module' => 'faq'),
			array('title' => '发票', 'module' => 'invoice'),
			array('title' => '功能介绍', 'module' => 'introducing_function'),
			array('title' => '支付帮助', 'module' => 'pay_help'),
		),
		'about' => array(
			array('title' => '关于我们', 'module' => 'about'),
			array('title' => '商务合作', 'module' => 'cooperation'),
			array('title' => '加入我们', 'module' => 'join_us'),
			array('title' => '免责声明', 'module' => 'disclaimer'),
			array('title' => '联系我们', 'module' => 'contact_us'),
		),
	);
	public $channel_title = array(
		'help'  => '帮助中心',
		'about' => '关于米律',
	);
	public function detail(){
		$module = $this->_get('module', '对不起，您的操作有误！');
		$channel_list = $this->get_channel_list($module);
		$info = D('Article')->get_page_content($module, '');
		$this->add_step($info['title']);

		$this->assign('info', $info);
		$this->assign('channel_list', $channel_list);
		$this->display();
	}
	private function get_channel_list($module = ''){
		foreach ($this->channel_list as $key => $value) {
			foreach ($value as $rs) {
				$data[$rs['module']] = $key;
			}
		}
		$old_key = $data[$module];
		$key     = $old_key ? $old_key : 'help';
		$channel_list = $this->channel_list[$key];
		$module       = $old_key ? $module : $channel_list[0]['module'];
		$this->module = $module;
		$this->assign('module', $module);
		$this->assign('channel_name', $this->channel_title[$key]);

		return $channel_list;
	}
}